package login

import (
	"lnzw/common/proto/cs_gen"
	"lnzw/engine/define"
	"lnzw/engine/net/tcp"
	nw "lnzw/engine/net/work"
	"lnzw/server/gatesvr/wdef"
	"lnzw/server/logic/basework"

	"google.golang.org/protobuf/proto"
)

func init() {
	// login := &UserLogin[proto.Message, proto.Message]{}
	// codemapping.Register(int32(cs_gen.ReqLogin_ID), &cs_gen.ReqLogin{}, &cs_gen.ResLogin{}, login)
}

type UserLogin[Req proto.Message, Res proto.Message] struct {
	nw.ProtobufNetWork[Req, Res]
	basework.NetWork[Req, Res]
}

func (w *UserLogin[Req, Res]) Handle(conn *tcp.SocketClient, req proto.Message, res proto.Message) {
	reqLogin := req.(*cs_gen.ReqLogin)
	resLogin := res.(*cs_gen.ResLogin)
	println(reqLogin.Account, reqLogin.Password, resLogin.Result)
}

func (w *UserLogin[Req, Res]) QueueId() define.QueueType {
	return wdef.Login
}
